#pragma once

#include "R09InstructionSet.h"
#include "R09RegisterSet.h"
#include "RAM.h"

using namespace System::Threading::Tasks;

namespace VirtualHardware
{
	public ref class R09CPU sealed : R09InstructionSet
	{
	public:
		Boolean running;

		R09CPU(RAM^ ramHandle);

		Boolean StartCPU(UInt32 startAddress);
		void Fetch();
		void Execute();
		Boolean LoadDataToMemory(array<UInt32>^ dataHandle, UInt32 startAddress);
		Boolean LoadProgramToStack(array<UInt32>^ programHandle, Boolean jumpToAddress);

	private:
		Task^ task;

		void TaskFunction();
	};
}
